/*
 * EtatRobotEnChargeFaceObstacle.cpp
 *
 *  Created on: 21 nov. 2011
 *      Author: jeddi
 */
#include "EtatRobotEnChargeFaceObstacle.h"
#include "EtatRobotEnCharge.h"
#include "EtatRobotAVideFaceObstacle.h"

EtatRobotEnChargeFaceObstacle* EtatRobotEnChargeFaceObstacle::instance = NULL;

EtatRobotEnChargeFaceObstacle* EtatRobotEnChargeFaceObstacle::getInstance(Robot* r){

	if(instance == NULL)
		instance = new EtatRobotEnChargeFaceObstacle(r);

	return instance;
}

void EtatRobotEnChargeFaceObstacle::poser() {
	r->setObjet(NULL);
	r->changerAncienEtat(this);
	r->changerEtat((EtatRobot*)EtatRobotAVideFaceObstacle::getInstance(r));
}

int EtatRobotEnChargeFaceObstacle::peser() {
	return r->getObjet().getPoids();
}

void EtatRobotEnChargeFaceObstacle::tourner(string direction) {
	r->setDirection(direction);
	r->changerAncienEtat(this);
	r->changerEtat((EtatRobot*)EtatRobotEnCharge::getInstance(r));
}
